<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>数组排重</title>
</head>
<body>
    <script>
       function paiChong(array){
            //  i 在这里为索引值
             for(var i = array.length - 1; i >= 0;i--){

               for(var j = i - 1; j >= 0; j--){
                   if(array[i] == array[j]){
                    // 删除重复的元素
                    array.splice(j,1);
                    //i--;   
                    break;
                   }
               } 
             }
             return array;
       } 
       var arr = [1,2,6,3,7,4];
       var result = paiChong(arr);
       console.dir(result);

    //    var arr2 = ['a','c',1,4,6,1,'a','b',4];
    //    var x = 0;
    //    while(x != arr2.length){
    //        for(x = 0;x < arr2.length; x++){
    //            for(var y = x+1; y < arr2.length; y++){
    //                if()
    //            }
    //        }
    //    }

    </script>
</body>
</html>